package com.yf.exam.modules.exam.ext.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;

/**
* <p>
* 试卷请求类
* </p>
*
* @author 聪明笨狗
* @since 2020-05-25 17:31
*/
@Data
@ApiModel(value="监考查询响应类", description="监考查询响应类")
public class WatchUserRespDTO implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "考卷ID", required=true)
    private String id;

    @ApiModelProperty(value = "是否在线", required=true)
    private Boolean online;

    @ApiModelProperty(value = "用户ID", required=true)
    private String userId;

    @ApiModelProperty(value = "姓名", required=true)
    private String realName;

    @ApiModelProperty(value = "截屏或头像", required=true)
    private String image;

    @ApiModelProperty(value = "总题数", required=true)
    private Integer quCount;

    @ApiModelProperty(value = "已答题数", required=true)
    private Integer answerCount;

    @ApiModelProperty(value = "答题进度", required=true)
    private Integer answerPercent;


    /**
     * 计算答题进度
     * @return
     */
    public Integer getAnswerPercent(){
        if(this.answerCount > 0 && this.quCount>0){
            return this.answerCount*100 / this.quCount;
        }
        return 0;
    }

}
